<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>openstack</title>
<meta
	content='width=device-width,initial-scale=1, maximum-scale=1, user-scalable=no'
	name='viewport'>
<!-- Bootstrap 3.3.4 -->
<link
	href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}"
	rel="stylesheet" type="text/css" />

<link
	href="{{ url_for('static', filename='dist/css/AdminLTE.min.css') }}"
	rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
<link
	href="{{ url_for('static', filename='dist/css/skins/_all-skins.min.css') }}"
	rel="stylesheet" type="text/css" />

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->

</head>
<body class="skin-blue sidebar-mini">
	<div class="wrapper">

		<header class="main-header">
			<!-- Logo -->
			<a href="../../index2.html" class="logo">Openstack <!-- mini logo for sidebar mini 50x50 pixels -->
				<span class="logo-mini"><b>A</b>LT</span> <!-- logo for regular state and mobile devices -->
				<span class="logo-lg"><b>Openstack</b></span>
			</a>
			<nav class="navbar navbar-static-top" role="navigation">
				<section class="content-header">

					<ol class="breadcrumb">
						<li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
						<li><a href="#">{{nav_a}}</a></li>
						<li class="active" style="color: red;font-style: oblique;font-family: monospace;">{{nav_b}}</li>
					</ol>
				</section>
				<div class="navbar-custom-menu">
					<ul class="nav navbar-nav">
						<!-- Messages: style can be found in dropdown.less-->

						<ul class="dropdown-menu">

							<li>
								<!-- inner menu: contains the actual data -->
								<ul class="menu">
									<!-- Control Sidebar Toggle Button -->
									<li><a href="#" data-toggle="control-sidebar"><i
											class="fa fa-gears"></i></a></li>
								</ul>
				</div>
			</nav>
		</header>
		<!-- Left side column. contains the logo and sidebar -->
		{% include "sidebar.html" %}

		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->

{% if welcomePage %}
<div class="col-md-offset-1 main">
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
  <div class="container">
    <h1>云平台安全测试系统</h1>
    <p>云平台安全测试系统是针对oVirt-KVM和OpenStack-KVM两个云平台实现自动化安全测试系统。本系统目前包含三项测试内
容，分别是加密检测、安全隔离和安全扫描，对指定云平台从上到下的安全问题进行有选择的自动化测试，并给出测试分析报告。测试结果以报告形式存储域数据库
中，并支持PDF、TXT等多种形式的报告下载。测试条目以代理形式接入系统，根据测试指标的实际对象与具体方法，测试代理划分为四个代理端，分别是
Engine_ta和Node_ta（其中ta为Test Agent）。</p>
   
  </div>
</div>
<h2 class="sub-header">测试系统</h2>
<!-- Three columns of text below the carousel -->
<div class="marketing row">
  <div class="col-md-4">
    <img class="img-circle" src="/static/img/enc.jpg" alt="Generic placeholder image" height="140" width="140">
    <h3>加密检测</h3>
    <p>加密检测子系统主要对Ovirt云平台主要通信段的通信信息进行抓包提取匹配测试，验证其信息交互的安全性。检测方法，主要是采用数据抓包和关键字匹配技术。</p>
    
  </div><!-- /.col-lg-4 -->
  <div class="col-md-4">
    <img class="img-circle" src="/static/img/iso.jpg" alt="Generic placeholder image" height="140" width="140">
    <h3>安全隔离</h3>
    <p>安全隔离子系统包含云平台下的内存、网络和存储等三方面的隔离监控。内存方面，获取进程及模块信息；网络方面，获取VM服务信息；存储方面，获取磁盘可挂载、加密及擦除信息。</p>
    
  </div><!-- /.col-lg-4 -->
  <div class="col-md-4">
 
    <img class="img-circle" src="/static/img/scan.jpg" alt="Generic placeholder image" height="140" width="140">
    <h3>安全扫描</h3>
    <p>安全扫描子系统是针对云平台下的所有虚拟机，提供漏洞扫描和病毒扫描服务。作为云平台的监控中心，批量性的扫描所有虚拟机的安全问题。</p>
    
  </div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<h2 class="sub-header">被测对象</h2>
<!-- Three columns of text below the carousel -->
<div class="marketing row">
  <div class="col-md-4">
    <img class="img-circle" src="/static/img/kvm.jpg" "="" alt="Generic placeholder image" height="140" width="140">
    <h3>KVM</h3>
    <p>KVM是一个开源的系统虚拟化模块，自Linux 
2.6.20之后集成在Linux的各个主要发行版本中。KVM虚拟化是基于硬件的完全虚拟化，KVM只是虚拟化解决方案的一部分。KVM其底层需要处理
器（Intel VT技术或者AMD-V技术）支持，为多个操作系统提供虚拟化处理器，I/O通过QEMU进行。</p>
    
  </div><!-- /.col-lg-4 -->
  <div class="col-md-4">
    <img class="img-circle" src="/static/img/ovirt.jpg" "="" alt="Generic placeholder image" height="140" width="140">
    <h3>oVirt</h3>
    <p>Ovirt是一个开源的虚拟化管理平台,负责管理基于KVM虚拟机的分布式管理。Ovirt 
engine是基于web的虚拟化管理平台。oVirt是一种私有云解决方案，适合小规模的使用。系统主体提供包括数据库、web服务、用户及用户组管
理、封装配置信息和命令组等功能。实现了所有逻辑功能。</p>
    
  </div><!-- /.col-lg-4 -->
  <div class="col-md-4">
    <img class="img-circle" src="/static/img/openstack.jpg" "="" alt="Generic placeholder image" height="140" width="140">
    <h3>OpenStack</h3>
    <p>OpenStack是由全球合作的开发者和云计算技术专家打造的开源云计算平台，适用于公有云和私有云。该项目的目标是通过自身的易于实
施、可大规模扩展、以及功能丰富等特性，提供对所有类型的云的解决方案。该技术由一系列相互关联的项目组成的，它们为云基础架构解决方案提供各种组件。</p>
    
  </div><!-- /.col-lg-4 -->
</div><!-- /.row -->
        </div>
      </div>
    </div>
    <div id="modal_wrapper"></div>
{% else %}

			<!-- Main content -->
			<section class="content">
				<!-- 加内容 -->
				<div class="well help">
					<table>
						<tbody>
							<tr>
								<!-- <td><img src=""></td> -->
								<td>
									<table>
										<tbody>
											<tr>
												<td colspan="2"><h3>&nbsp;&nbsp;&nbsp;内容介绍：</h3></td>
											</tr>
											<tr>
												<td><img class="img-circle" src="{{introduce.picture}}"
													type="align:right" style="width: 100px; height: 100px;"></td>
												<td>
													<h4>{{introduce['content']}}</h4>
												</td>
											</tr>
										</tbody>
									</table>
									<table>
										<tbody>
											<tr>
												<td colspan="2"><h3>&nbsp;&nbsp;&nbsp;方法介绍：</h3></td>
											</tr>
											<tr>
												<td>{{introduce['method']|safe}}</td>
											</tr>
											<tr>
											</tr>
											<table class="table">
												<tbody>
													<tr>
														<td><span class="glyphicon glyphicon-cog"
															aria-hidden="true"></span>&nbsp;&nbsp;配置</td>
														<td>{{introduce['setup']}}</td>
													</tr>
													<tr>
														<td><span class="glyphicon glyphicon-tasks"
															aria-hidden="true"></span>&nbsp;&nbsp;测试方法</td>
														<td>{{introduce['testmethod']}}</td>
													</tr>
													<tr>
														<td><span class="glyphicon glyphicon-log-out"
															aria-hidden="true"></span>&nbsp;&nbsp;报告</td>
														<td>{{introduce['report']}}</td>
													</tr>
												</tbody>
											</table>

										</tbody>
									</table>
								</td>
							</tr>
						</tbody>
					</table>
				</div>


				<!-- Default box -->




			</section>

			<table class="table table-hover" style="margin-left: 60px">
				<tr>
					<th>ID</th>
					<th>IP</th>
					<th>PORT</th>
					<th>Status</th>

					<th colspan="3">操作</th>
				</tr>
				{% for item in list %}
				<tr>
					<td>{{item[0]}}</td>
					<td>{{item[1]}}</td>
					<td>{{item[2]}}</td>

					<td>就绪</td>
					<form action="" method="post" onsubmit="return check();">
						<input type="hidden" value="{{item[0]}}" name="id"> <input
							type="hidden" value="{{item[1]}}" name="ip"> <input
							type="hidden" value="{{item[2]}}" name="port">
						<td><input class="btn" value="测试" type="button" id="test">
							<input class="btn" value="报告" type="button" id="report">

							<button class="btn" id="config">设置</button></td>
					</form>
				</tr>
				{% endfor %}
			</table>

			</section>
{% endif %}
			<!-- /.sidebar -->
			</aside>


			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header"></section>

				<!-- Main content -->
				<section class="content"></section>
				<!-- /.content -->
			</div>
			<!-- /.content-wrapper -->


			<!-- Control Sidebar -->
			<aside class="control-sidebar control-sidebar-dark">
				<!-- Create the tabs -->
				<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
					<li><a href="#control-sidebar-home-tab" data-toggle="tab"><i
							class="fa fa-home"></i></a></li>

					<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i
							class="fa fa-gears"></i></a></li>
				</ul>
				<!-- Tab panes -->
				<div class="tab-content">
					<!-- Home tab content -->
					<div class="tab-pane" id="control-sidebar-home-tab">
						<h3 class="control-sidebar-heading">Recent Activity</h3>
						<ul class='control-sidebar-menu'>
							<li><a href='javascript::;'> <i
									class="menu-icon fa fa-birthday-cake bg-red"></i>
									<div class="menu-info">
										<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
										<p>Will be 23 on April 24th</p>
									</div>
							</a></li>
							<li><a href='javascript::;'> <i
									class="menu-icon fa fa-user bg-yellow"></i>
									<div class="menu-info">
										<h4 class="control-sidebar-subheading">Frodo Updated His
											Profile</h4>
										<p>New phone +1(800)555-1234</p>
									</div>
							</a></li>
							<li><a href='javascript::;'> <i
									class="menu-icon fa fa-envelope-o bg-light-blue"></i>
									<div class="menu-info">
										<h4 class="control-sidebar-subh <div class="progressprogress-stripedactive">
											<div class="progress-bar" style="width: 60%; display: none">执行中</div>
									</div>eading">Nora Joined Mailing List
									</h4>
									<p>nora@example.com</p>
					</div>
					</a>
					</li>
					<li><a href='javascript::;'> <i
							class="menu-icon fa fa-file-code-o bg-green"></i>
							<div class="menu-info">
								<h4 class="control-sidebar-subheading">Cron Job 254
									Executed</h4>
								<p>Execution time 5 seconds</p>
							</div>
					</a></li>
					</ul>
					<!-- /.control-sidebar-menu -->

					<h3 class="control-sidebar-heading">Tasks Progress</h3>
					<ul class='control-sidebar-menu'>
						<li><a href='javascript::;'>
								<h4 class="control-sidebar-subheading">
									Custom Template Design <span
										class="label label-danger pull-right">70%</span>
								</h4>
								<div class="progress progress-xxs">
									<div class="progress-bar progress-bar-danger"
										style="width: 70%"></div>
								</div>
						</a></li>
						<li><a href='javascript::;'>
								<h4 class="control-sidebar-subheading">
									Update Resume <span class="label label-success pull-right">95%</span>
								</h4>
								<div class="progress progress-xxs">
									<div class="progress-bar progress-bar-success"
										style="width: 95%"></div>
								</div>
						</a></li>
						<li><a href='javascript::;'>
								<h4 class="control-sidebar-subheading">
									Laravel Integration <span class="label label-waring pull-right">50%</span>
								</h4>
								<div class="progress progress-xxs">
									<div class="progress-bar progress-bar-warning"
										style="width: 50%"></div>
								</div>
						</a></li>
						<li><a href='javascript::;'>
								<h4 class="control-sidebar-subheading">
									Back End Framework <span class="label label-primary pull-right">68%</span>
								</h4>
								<div class="progress progress-xxs">
									<div class="progress-bar progress-bar-primary"
										style="width: 68%"></div>
								</div>
						</a></li>
					</ul>
					<!-- /.control-sidebar-menu -->

				</div>
				<!-- /.tab-pane -->
				<!-- Stats tab content -->
				<div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab
					Content</div>
				<!-- /.tab-pane -->
				<!-- Settings tab content -->
				<div class="tab-pane" id="control-sidebar-settings-tab">
					<form method="post">
						<h3 class="control-sidebar-heading">General Settings</h3>
						<div class="form-group">
							<label class="control-sidebar-subheading"> Report panel
								usage <input type="checkbox" class="pull-right" checked />
							</label>
							<p>Some information about this general settings option</p>
						</div>
						<!-- /.form-group -->

						<div class="form-group">
							<label class="control-sidebar-subheading"> Allow mail
								redirect <input type="checkbox" class="pull-right" checked />
							</label>
							<p>Other sets of options are available</p>
						</div>
						<!-- /.form-group -->

						<div class="form-group">
							<label class="control-sidebar-subheading"> Expose author
								name in posts <input type="checkbox" class="pull-right" checked />
							</label>
							<p>Allow the user to show his name in blog posts</p>
							<div class="progress progress-striped active">
								<div class="progress-bar" style="width: 60%; display: none">执行中</div>
							</div>
						</div>
						<!-- /.form-group -->

						<h3 class="control-sidebar-heading">Chat Settings</h3>

						<div class="form-group">
							<label class="control-sidebar-subheading"> Show me as
								online <input type="checkbox" class="pull-right" checked />
							</label>
						</div>
						<!-- /.form-group -->

						<div class="form-group">
							<label class="control-sidebar-subheading"> Turn off
								notifications <input type="checkbox" class="pull-right" />
							</label>
						</div>
						<!-- /.form-group -->

						<div class="form-group">
							<label class="control-sidebar-subheading"> Delete chat
								history <a href="javascript::;" class="text-red pull-right"><i
									class="fa fa-trash-o"></i></a>
							</label>
						</div>
						<!-- /.form-group -->
						<div class="progress progress-striped active">
							<div class="progress-bar" style="width: 60%; display: none">执行中</div>
						</div>
					</form>
				</div>
				<!-- /.tab-pane -->
		</div>
		</aside>
		<!-- /.control-sidebar -->
		<!-- Add the sidebar's background. This div must be placed
           immediately after the control sidebar -->
		<div class='control-sidebar-bg'></div>
	</div>
	<!-- ./wrapper -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">执行结果</h4>
				</div>
				<div class="modal-body"></div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>

				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
	<!--要传的额外变量放在这里  -->
	<input type="hidden" id="test_url" value="{{test}}"/>
	<input type="hidden" id="report_url" value="{{report}}"/>
	<!--磁盘路径  -->
	<input type="hidden" id="disk_path" value=""/>
	<!-- jQuery 2.1.4 -->
	<script
		src="{{ url_for('static', filename='plugins/jQuery/jQuery-2.1.4.min.js') }}"></script>
	<!-- Bootstrap 3.3.2 JS -->
	<script
		src="{{ url_for('static', filename='bootstrap/js/bootstrap.min.js') }}"
		type="text/javascript"></script>
	<!-- FastClick -->
	<script src='{{ url_for('static', filename='plugins/fastclick/fastclick.min.js') }}'></script>
	<!-- AdminLTE App -->
	<script src="{{ url_for('static', filename='dist/js/app.min.js') }}"
		type="text/javascript"></script>
	<!-- AdminLTE for demo purposes -->
	<script src="{{ url_for('static', filename='dist/js/demo.js') }}"
		type="text/javascript"></script>
	<script type="text/javascript">
		function check() {
			return false;
		}
		$(function() {
			//var progress=$('.progress progress-striped active');
			//console.info(progress);
			/* $("ul .treeview-menu li a").click(function(){
				var element=$(this).text();
				
				var ele=$(this).parent().parent().parent().children().eq(0).text();
				$(".breadcrumb").children().econtentq(1).text(ele);
			});
			 */
			 
			/*  $('ul.treeview-menu li').click(function(){
				 $('.active').removeClass('active');
				 $(this).parent().parent().addClass('active');
			 }); */
			 //测试按钮的url
			//var test_url='';
			 //报告按钮的url
			//var report_url=''
			var url='';
			$('.treeview-menu a').click(function(){
				url=($(this).attr('href'));
				//var array=url.split('/');
				//test_url='/'+array[1]+'/'+array[3]+'/test';
				//alert(test_url);
				//report_url='/'+array[1]+'/'+array[3]+'/report';
			});
			 
			$('#test').click(
							function() {
								var ip = $(this).parent().parent().children()
										.eq(1).text();
								var port = $(this).parent().parent().children()
										.eq(2).text();
								var td = $(this).parent().parent().children()
										.eq(3);
								//console.info(td);
								td.html(' <div class=\"progress progress-striped active\"><div class=\"progress-bar\" style=\"width: 100%;\">执行中</div></div>');
								var test_url=$('#test_url').val();
								//alert(test_url);
								//写上自己的参数,args为传递到后台的参数,如果有多个参数用逗号隔开
								var args="";
								if(test_url==='/disk/encrypt/test'){
									args=$('#disk_path').val();
									if(args==="")
									{
										//alert("请点击设置按钮设置要扫描的磁盘路径:");
										var diskpath=prompt("请输入磁盘路径L：","LL")
										//alert(diskpath);
										//$('#disk_path').val(diskpath);
										args=diskpath;
									}
								}else if(test_url=='/disk/virtio/test'){
										var keyword=prompt("请输入关键字，多个关键字之间用空格隔开","例如：云计算 大数据");
										args=keyword;
								}
								$.post(test_url, {
									'ip' : ip,
									'port' : port,
									'args':args
								}, function(data) {
									if (data == "success") {
										td.html("测试成功");
									} else {
										td.html("测试失败");
									}
								}, 'text');
			});

			$('#report').click(function() {
				var ip = $(this).parent().parent().children().eq(1).text();
				var port = $(this).parent().parent().children().eq(2).text();
				//var td=$(this).parent().parent().children().eq(3);
				//console.info(td);
				//td.html(' <div class=\"progress progress-striped active\"><div class=\"progress-bar\" style=\"width: 100%;\">执行中</div></div>');
				var report_url=$('#report_url').val();
				$.post(report_url, {
					'ip' : ip,
					'port' : port
				}, function(data) {
					$('.modal-body').html(data);
					$('#myModal').modal('show');
					//alert(data);
				}, 'text');
				//var data={'title':'123','content':'345'};

			});
			$('#config').click(function(){
				//alert('config');
				var diskpath=prompt("请输入磁盘路径L：","LL")
				//alert(diskpath);
				$('#disk_path').val(diskpath);
			});
		});
	</script>
</body>
</html>
